#! /bin/bash
# https://archive.apache.org/dist/spark/spark-3.0.0-preview2/spark-3.0.0-preview2-bin-hadoop3.2.tgz
# http://192.168.100.41/tar/spark-3.0.0-bin-hadoop3.2.tgz
#download_url=http://192.168.100.41/tar
download_url=https://archive.apache.org/dist/spark/spark-3.0.0-preview2
file_name=spark-3.0.0-preview2-bin-hadoop3.2.tgz


spark_url="${download_url}"/"${file_name}"

log_dir=/var/log/spark-download.log
file_dir=/tmp/"${file_name}"
install_dir=/opt


echo "downloag spark"
echo $spark_url
wget $spark_url  -O $file_dir  -a  $log_dir



tar zxf $file_dir -C $install_dir
sleep 5
echo 'export SPARK_HOME=/opt/spark-3.0.0-preview2-bin-hadoop3.2' >> /etc/profile
echo 'export PATH=$PATH:$SPARK_HOME/bin' >> /etc/profile

sleep 2
. /etc/profile
